<include file="public@header"/>
</head>
<body>
<div class="wrap js-check-wrap">
    <ul class="nav nav-tabs">
        <li class="active"><a href="{:url('AdminGoods/index')}">商品列表</a></li>
        <li><a href="{:url('AdminGoods/add')}">添加商品</a></li>
    </ul>
    <form class="well form-inline margin-top-20" id="search-form2" method="post" action="{:url('AdminGoods/index')}">

        分类：
        <select name="cat_id"  class="form-control">
            <option value='0'>全部</option>
            {$category_tree}
        </select> &nbsp;&nbsp;
        <select name="is_on_sale" class="form-control">
            <option value='-1'>全部</option>
            <option value='1'>上架</option>
            <option value='0'>下架</option>
        </select> &nbsp;&nbsp;&nbsp;
        关键字：
        <input type="text" name="keyword"  value="" placeholder="请输入关键字..." class="form-control">
        <button type="submit" class="btn btn-primary" value="搜索">搜索</button>
        <a class="btn btn-danger" href="{:url('AdminGoods/index')}">清空</a>
    </form>
    <form class="js-ajax-form" action="" method="post">
        <div class="table-actions">
            <button class="btn btn-danger btn-small js-ajax-submit"
                    type="submit"
                    data-action="{:url('AdminGoods/del')}"
                    data-subcheck="true"
                    data-msg="您确定删除吗？">删除</button>
        </div>
        <table class="table table-hover table-bordered table-list">
            <thead>
            <tr>
                <th width="15">
                    <label>
                        <input type="checkbox" class="js-check-all" data-direction="x" data-checklist="js-check-x"></label></th>
                <th width="50"><a href="javascript:sort('last_order');">排序</a></th>
                <th width="50"><a href="javascript:sort('id');">ID</a></th>
                <th><a href="javascript:sort('goods_name');">商品名称</a></th>
                <th width="100"><a href="javascript:sort('fans_money');">粉丝价格</a></th>
                <th width="100"><a href="javascript:sort('vip_money');">会员价格</a></th>
                <th width="50"><a href="javascript:sort('store_count');">库存</a></th>
                <th>分类</th>
                <th width="50">上架</th>
                <th width="50">推荐</th>
                <th width="50">新品</th>
                <th width="100">操作</th>
            </tr>
            </thead>
            <foreach name="goodslist" item="vo">
                <tr>
                    <td><input type="checkbox" class="js-check" data-yid="js-check-y" data-xid="js-check-x" name="ids[]"
                               value="{$vo.id}" title="ID:{$vo.id}"></td>
                    <td><input name="listorders[{$vo.id}]" class="input input-order"
                               onchange="updateSort('goods','id','{$vo.id}','last_order',this)" type="text" size="5"
                               value="{$vo.last_order}"></td>
                    <td>
                        <b>{$vo.id}</b>
                    </td>
                    <td>
                        <a href="{:url('Goods/article/index',array('g_id'=>$vo['id']))}" target="_blank">{$vo.goods_name}</a>
                    </td>

                    <td>{$vo.fans_money}元</td>
                    <td>{$vo.vip_money}元</td>
                    <td>
                        <input class="input input-order" type="text" size="5" value="{$vo.store_count}"
                               onchange="updateSort('goods','id','{$vo.id}','store_count',this)"/>
                    </td>
                    <td>{$vo.name}</td>


                    <td style='text-align:center;'>
                        <i class='fa <if condition="$vo.is_on_sale eq 1">fa-check <else/>fa-close</if>'
                           onclick="changeTableVal('goods','id','{$vo.id}','is_on_sale',this)"></i>
                    </td>

                    <td style='text-align:center;'>
                        <i class='fa <if condition="$vo.is_recommend eq 1">fa-check <else/>fa-close</if>'
                           onclick="changeTableVal('goods','id','{$vo.id}','is_recommend',this)"></i>
                    </td>
                    <td style='text-align:center;'>
                        <i class='fa <if condition="$vo.is_new eq 1">fa-check <else/>fa-close</if>'
                           onclick="changeTableVal('goods','id','{$vo.id}','is_new',this)"></i>
                    </td>


                    <td>
                        <a href="{:url('AdminGoods/edit',array('id'=>$vo['id']))}">编辑</a> |
                        <a href="{:url('AdminGoods/del',array('ids'=>$vo['id']))}" class="js-ajax-delete">删除</a>
                    </td>
                </tr>
            </foreach>

        </table>
        <div class="pagination">{$page}</div>

    </form>
</div>
<script src="__STATIC__/js/admin.js"></script>
<script src="__STATIC__/js/myajax.js"></script>
</body>
</html>